/**
 * 
 */
package util;

/**
 * Timer are used to calculate the time elapse
 * @author yexijiang
 * @date Jul 4, 2008
 */
public class Timer 
{
	/**
	 * Get the current time
	 * @return	current time in millisecond
	 */
	public static long startRecord()
	{
		return System.currentTimeMillis();
	}
	
	/**
	 * Get the elapsed time by millisecond
	 * @param	startTime	the start time in millisecond
	 * @return	the time a process cost in millisecond
	 */
	public static long endRecord(long startTime)
	{
		long now = System.currentTimeMillis();
		long diff = now - startTime;
		return diff;
	}
	
	/**
	 * Get the elapse time by second
	 * @param	startTime	the start time in millisecond
	 * @return	the time a process cost in second
	 */
	public static long endRecordBySecond(long startTime)
	{
		return endRecord(startTime) / 1000;
	}
}
